﻿using Prism.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace DailyApp.WPF.Views
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {

        //命令
        public DelegateCommand BtnMinCmd { get; set; }
        public DelegateCommand BtnMaxCmd { get; set; }
        public DelegateCommand BtnCloseCmd { get; set; }


        /// <summary>
        /// 构造函数
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            //绑定委托命令
            BtnMinCmd = new DelegateCommand(BtnMinFunc);
            BtnMaxCmd = new DelegateCommand(BtnMaxFunc);
            BtnCloseCmd = new DelegateCommand(BtnCloseFunc);
        }


        //具体方法

        /// <summary>
        /// 最小化
        /// </summary>
        private void BtnMinFunc()
        {
            this.WindowState = WindowState.Minimized;
        }

        /// <summary>
        /// 最大最小化
        /// </summary>
        private void BtnMaxFunc()
        {
            if (this.WindowState == WindowState.Normal)
                WindowState = WindowState.Maximized;
            else
                WindowState = WindowState.Normal;

        }

        /// <summary>
        /// 关闭
        /// </summary>
        private void BtnCloseFunc()
        {
            Environment.Exit(0);
        }
    }
}
